package com.wzy.media.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author wzy
 * @Date 2024/2/2 13:29
 * @description: 调用内容服务熔断降级方法
 */
@Slf4j
@Component
public class ContentServiceClientFallbackFactory implements FallbackFactory<ContentFeignClient> {
    @Override
    public ContentFeignClient create(Throwable throwable) {
        return new ContentFeignClient() {
            @Override
            public List<TeachplanMedia> getTeachPlanByMediaId(String mediaId) {
                log.debug("调用媒资管理服务上传文件时发生熔断，异常信息:{}",throwable.toString(),throwable);
                return null;
            }
        };
    }
}
